<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<base href="<%=basePath%>">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>网站信息</title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script type="text/javascript" src="js/upload.js"></script>
<script type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
<script src="js/selectdata.js"></script>
<script src="js/Listdata.js"></script>

</head>
<body>
	<form name="form1" id="searchform" method="post"
		action="<%=path%>/admin/checkin_addCheckIn.action">

		<div class="panel admin-panel">

			<div class="panel-head">
				<strong class="icon-reorder"> 内容列表</strong> <a href=""
					style="float:right; display:none;">添加字段</a>
			</div>
			<div class="padding border-bottom">
				<ul class="search" style="padding-left:10px;">

					<li>请选择：</li>
					<li>学院 <select id="academySelect" class="input"
						onchange="changeselect()"
						style="width:200px; line-height:17px; display:inline-block">
							<option value="">请选择学院</option>
					</select> <input type="hidden" id="academyName" name="pageing.academy" />
						&nbsp;&nbsp; 班级 <select id="classSelect" class="input"
						onchange="changeselect1()"
						style="width:200px; line-height:17px; display:inline-block">
							<option value="">请选择班级</option>
					</select> <input type="hidden" id="className" name="pageing.stuClass" />
						&nbsp;&nbsp; 课程 <select id="courseSelect" class="input"
						onchange="changeselect2()"
						style="width:200px; line-height:17px; display:inline-block">
							<option value="">请选择课程</option>
					</select> <input type="hidden" id="courseName" name="pageing.course" />
					</li>
					<if condition="$iscid eq 1">
					<li><a href="javascript:void(0)"
						class="button border-main icon-search" onclick="changesearch()">
							搜索</a></li>
							<li><a href="javascript:void(0)"
						class="button border-main icon-search" onclick="randomsearch()">
							随机考勤</a></li>
					</if>
					</if>
				</ul>

			</div>
			<table class="table table-hover text-center" id="voCheckIn">
				<tr>
					<th>班级</th>
					<th>课程</th>
					<th>学号</th>
					<th width="20%">姓名</th>
					<th width="25%">操作</th>
					<th width="5%">请假</th>
					<th width="5%">迟到</th>
					<th width="5%">旷课</th>
				</tr>
				<input type="hidden" id="CheckInList" name="CheckInList">
			</table>

		</div>
	</form>
	<input type="hidden" id="sum">
	<script type="text/javascript">

$(function(){
	 addData(); //异步ajax动态加载数据
});

function selectCheck(thisCheck){
}
//搜索
function changesearch(){
	 if($("#academySelect").val()==""){
		 alert("请选择学院");
		 return false;
	 }else if($("#classSelect").val()==""){
		 alert("请选择班级");
		 return false;
	 }else if($("#courseSelect").val()==""){
		 alert("请选择课程");
		 return false;
	 }else {
		 addData(); //异步ajax动态加载数据
	 }
	
}
//随机考勤
function randomsearch(){
	 if($("#academySelect").val()==""){
		 alert("请选择学院");
		 return false;
	 }else if($("#classSelect").val()==""){
		 alert("请选择班级");
		 return false;
	 }else if($("#courseSelect").val()==""){
		 alert("请选择课程");
		 return false;
	 }else {
		 ListData();
	 }
	
}
function changeselect3(){
		$("#keywords").attr('name',$("#cid").val());
}

//单个删除
function del(id,mid,iscid){
	if(confirm("您确定要删除吗?")){
		window.location='<%=path%>/admin/student_deleteStudent.action?student.id='+ id;
			}
		}

		//全选
		$("#checkall").click(function() {
			$("input[name='deleteList']").each(function() {
				if (this.checked) {
					this.checked = false;
				} else {
					this.checked = true;
				}
			});
		})

		//批量删除
		function DelSelect() {

			var Checkbox = false;
			$("input[name='deleteList']").each(function() {
				if (this.checked == true) {
					Checkbox = true;
				}
			});
			if (Checkbox) {
				var t = confirm("您确认要删除选中的内容吗？");
				if (t == false)
					return false;

				$("#listform").submit();
			} else {
				alert("请选择您要删除的内容!");
				return false;
			}
		}

		//提交
		function submitSelect() {
			var arr1 = "";
			var arr2 = "";
			var arr3 = "";
			for (var i = 0; i < $("#sum").val(); i++) {
				$("input[name='CheckList" + i + "']").each(
						function(index, value) {
							var va = this.value.split('|');
							if (this.checked == true) {
								if (va[0] == '1') { //迟到
									arr1 = arr1 + va[1] + ";";
								} else if (va[0] == '2') { //请假
									arr2 = arr2 + va[1] + ";";
								} else if (va[0] == '3') { //旷课
									arr3 = arr3 + va[1] + ";";
								}

							}
						});

			}
			var arr = [ arr1, arr2, arr3 ];
			$("#CheckInList").attr('value', arr);
			$("#searchform").submit();

		}
	</script>
</body>
</html>